package de.tmahr.android;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import de.tmahr.android.animation.KreisAnimation;
import de.tmahr.android.animation.RenderView;
import de.tmahr.android.logger.BufferedTextViewLogger;
import de.tmahr.android.logger.Logger;

/**
 * In diesem Test werden zwei Instanzen der Klasse @see de.tmahr.android.RenderView in das
 * XML-Layout aufgenommen.
 */
public class LayoutGraphicsTest3 extends Activity
{
	private TextView textView;
	private RenderView renderView1;
	private RenderView renderView2;
	private Logger logger;

	@Override
	public void onCreate(Bundle b)
	{
		super.onCreate(b);
		setTitle(LayoutGraphicsTest3.class.getSimpleName());
		setContentView(R.layout.layoutgraphicstest3);

		textView = (TextView) findViewById(R.id.textView);
		textView.setText(LayoutGraphicsTest3.class.getSimpleName());

		logger = new BufferedTextViewLogger(
				LayoutGraphicsTest3.class.getSimpleName(), textView);
		logger.log("onCreate");

		renderView1 = (RenderView) findViewById(R.id.renderView1);
		renderView1.setSimulation(new KreisAnimation());
		renderView1.setLogger(logger);

		renderView2 = (RenderView) findViewById(R.id.renderView2);
		renderView2.setSimulation(new KreisAnimation());
		renderView2.setLogger(logger);
	}

	@Override
	protected void onPause()
	{
		super.onPause();
		renderView1.pause();
		renderView2.pause();
	}

	@Override
	protected void onResume()
	{
		super.onResume();
		renderView1.resume();
		renderView2.resume();
	}
}
